package com.autumn.security.auth;

/**
 * 第三方登录票据
 * 
 * @author 杨昌国 2018-12-06 02:41:50
 */
public class ExternalProviderToken extends AbstractAuthenticationToken {

	/**
	 * 
	 */
	private static final long serialVersionUID = 4240355263745558327L;

	private final String provider;
	private final String providerKey;

	/**
	 * 
	 * @param provider
	 * @param providerKey
	 */
	public ExternalProviderToken(String provider, String providerKey) {
		this.provider = provider;
		this.providerKey = providerKey;
	}

	/**
	 * 
	 * @param provider
	 * @param providerKey
	 * @param identityType
	 */
	public ExternalProviderToken(String provider, String providerKey, String identityType) {
		super(identityType);
		this.provider = provider;
		this.providerKey = providerKey;
	}

	/**
	 * 获取提供程序
	 * 
	 * @return
	 */
	public String getProvider() {
		return provider;
	}

	/**
	 * 获取提供程序键
	 * 
	 * @return
	 */
	public String getProviderKey() {
		return providerKey;
	}

	@Override
	public Object getPrincipal() {
		return this.getProvider();
	}

	@Override
	public Object getCredentials() {
		return this.getProviderKey();
	}

}
